#!/usr/bin/perl

$raw = "#define LIN_BUS_ACTIVITY_MASK         32 /**< aaaaaa asdf asd f fadf */";

if($raw =~ /\#define ([A-Z0-9_]+_MASK)(\s+)([0-9]+)(\s+)/) {
	print "It matches\n";
  print "1: [$1]\n";
  print "2: [$2]\n";
  printf ("3: [0x%x]\n", $3);
  
  if( $3 < 9 ){
    $x = sprintf("0x0%x", $3);
  }else{
    $x = sprintf("0x%x", $3);
  }
  print "4: [$4]\n";
  print "$raw\n";
  $raw =~ s/\#define ([A-Z0-9_]+_MASK)(\s+)([0-9]+)(\s+)/\#define $1$2$x$4/;
  print "$raw\n";
} else {
	print "It not matches\n";
}

